-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle explicit conversions between enums and native integers #48041
Conversation
src/Compilers/CSharp/Test/Semantic/Semantics/NativeIntegerTests.cs
Outdated
Show resolved
Hide resolved
nit: should the comment be update, and/or the native ints spec? #Resolved Refers to: src/Compilers/CSharp/Portable/Binder/Semantics/Conversions/ConversionsBase.cs:1985 in 0dc6d46. [](commit_id = 0dc6d46, deletion_comment = False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM Thanks (iteration 3)
Updated comment. And @Youssef1313 has updated the spec in dotnet/csharplang#3941. In reply to: 699029430 [](ancestors = 699029430) Refers to: src/Compilers/CSharp/Portable/Binder/Semantics/Conversions/ConversionsBase.cs:1985 in 0dc6d46. [](commit_id = 0dc6d46, deletion_comment = False) |
@@ -1841,12 +1845,16 @@ public static bool IsConstantNumericZero(ConstantValue value) | |||
return value.Int32Value == 0; | |||
case ConstantValueTypeDiscriminator.Int64: | |||
return value.Int64Value == 0; | |||
case ConstantValueTypeDiscriminator.NInt: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add labels to the Int32 and UInt32 sections instead of creating new switch sections for these? #Resolved
{ | ||
string source = | ||
@"using static System.Console; | ||
enum E { A = -1, B = 1 } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any need to test conversion of enums with various underlying types? #Resolved
Fixes #48035
Test plan #38821